isCOBOL Evolve : Language Reference : Program Structure
Program Structure
Synopsis
The schema below shows how a COBOL program is structured. For simplifying access to information, it has been split into smaller parts.
COBOL Program
 [{IDENTIFICATION} DIVISION. ]
  {ID            }
 
  { {PROGRAM-ID  }. Program-Name [ IS {INITIAL } PROGRAM ] .
                                      {RESIDENT}
 
      [ AUTHOR. [Comment-Entry .] ]
 
      [ INSTALLATION. [Comment-Entry .] ]
 
      [ DATE-WRITTEN. [Comment-Entry .] ]
 
      [ DATE-COMPILED. [Comment-Entry .] ]
 
      [ SECURITY. [Comment-Entry .] ]
 
      [ REMARKS. [Comment-Entry .] ]
 
 
      [ DATA DIVISION. ]
 
 
      [ END PROGRAM [ Program-Name ]. ] }
 
COBOL Class
 [{IDENTIFICATION} DIVISION. ]
  {ID            }
 
  { CLASS-IDClass-Name [ AS Literal ]
 
                           [ INHERITS FROM Class-Name ]
 
                           [ IMPLEMENTS { Interface-Name } ... ] .
  
      [ AUTHORComment-Entry . ]
 
      [ INSTALLATIONComment-Entry . ]
 
 
      [ DATE-WRITTENComment-Entry . ]
 
      [ DATE-COMPILEDComment-Entry . ]
 
      [ AUTHORComment-Entry . ]
 
      [ INSTALLATIONComment-Entry . ]
 
      [ DATE-WRITTENComment-Entry . ]
 
      [ DATE-COMPILEDComment-Entry . ]
 
      [ SECURITYComment-Entry . ]
 
      [ REMARKSComment-Entry . ]
 
 
      [ {IDENTIFICATIONDIVISION.
        {ID            }
 
        FACTORY.
 
          [ ENVIRONMENT DIVISION. ]
 
          [ DATA DIVISION. ]
 
          [ PROCEDURE DIVISION.
 
            [ {IDENTIFICATION} DIVISION.
              {ID            }
 
              METHOD-IDMethod-Name [ AS Literal ] [ IS {PUBLIC   } ] [ OVERRIDE ].
                                                         {PRIVATE  }
                                                         {PROTECTED}
 
                [ ENVIRONMENT DIVISION. ]
 
                [ DATA DIVISION. ]
 
                PROCEDURE DIVISION
 
                END METHOD [ Method-Name ]. ] ... ]
 
          END FACTORY. ]
 
      [ {IDENTIFICATIONDIVISION.
        {ID            }
 
        OBJECT.
 
          [ ENVIRONMENT DIVISION. ]
 
          [ DATA DIVISION. ]
 
 
          [ PROCEDURE DIVISION.
 
            [ {IDENTIFICATION} DIVISION.
              {ID            }
 
              METHOD-IDMethod-Name [ AS Literal ] [ IS {PUBLIC   } ] [ OVERRIDE ].
                                                         {PRIVATE  }
                                                         {PROTECTED}
 
                [ ENVIRONMENT DIVISION. ]
 
                [ DATA DIVISION. ]
 
                PROCEDURE DIVISION
 
                END METHOD [ Method-Name ]. ] ... ]
 
          END OBJECT. ]
      [ END CLASS [ Class-Name ]. ] }
Syntax rules
1. Program-Name is a User-defined word, as defined in the Definitions section in the Preface of this document.
2. Each reference to Comment-Entry is a Comment-Entry, as defined in the Definitions section in the Preface of this document.
3. Each reference to Class-Name is a User-defined word, as defined in the Definitions section in the Preface of this document.
4. Interface-Name is a User-defined word, as defined in the Definitions section in the Preface of this document.
5. Each reference to Method-Name is a User-defined word, as defined in the Definitions section in the Preface of this document.
6. Each reference to Literal is a Nonnumeric Literal, as defined in the Definitions section in the Preface of this document.
General rules
1. Multiple programs can be included in the same source file.
If a program is included before the END PROGRAM clause of another program, it becomes a nested program, and it can be called only by his parent program.
If a program is included after the END PROGRAM clause of another program, it becomes a sibling program, and it can be called by every other program in the runtime session.
 
The below table summarizes the possible combinations of different types of program in the same source file:
 
Can be sibling to
Can be nested in
PROGRAM-ID
FUNCTION-ID
CLASS/INTERFACE-ID
PROGRAM-ID
FUNCTION-ID
CLASS/INTERFACE-ID
PROGRAM-ID
X
X
 
X
 
 
FUNCTION-ID
X
X
 
X
 
 
CLASS/INTERFACE-ID
 
 
X